package com.ibm.mall.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibm.mall.dao.CommodityDao;
import com.ibm.mall.model.Commodity;
import com.ibm.mall.model.PageBean;
import com.ibm.mall.service.CommodityService;
import com.ibm.mall.util.QueryHelper;

@Service
@Transactional
public class CommodityServiceImpl implements CommodityService {
	
	@Resource
	private CommodityDao commodityDao;

	@Override
	public void saveCommodity(Commodity model) {
		commodityDao.save(model);
	}

	@Override
	public List<Commodity> getAllCommodity() {
		return commodityDao.findAll();
	}

	@Override
	public void updateCommodity(Commodity model) {
		commodityDao.update(model);
	}

	@Override
	public Commodity getCommodityById(Integer id) {
		return commodityDao.getById(id);
	}

	@Override
	public PageBean getPageBean(int pageNum, int pageSize,
			QueryHelper queryHelper) {
		return commodityDao.getPageBean(pageNum, pageSize, queryHelper);
	}

}
